home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.src.lzh / include / news.h < prev   
C/C++ Source or Header  |  1989-06-29  |  5KB  |  163 lines

  1. #ifndef _NEWS_H_
  2. #define _NEWS_H_
  3. /*
  4.  * definitions unique to all of C news
  5.  * things marked with qqq are subject to being configured by "build"
  6.  */
  7.  
  8. /*
  9.  * tunable parameters
  10.  * which actually very seldom need to be tuned
  11.  * in particular, don't get alarmed about MAXCOMP, it's not used for
  12.  *  anything where it matters
  13.  */
  14.  
  15. #define MAXPATH 1024        /* max. length of pwd output */
  16. #define MAXCOMP 14        /* file name component length */
  17. #define MAXHOST 128        /* max. length of this host's name */
  18. #define SPOOLTMP ".tmpXXXXXX"    /* template for NEWSARTS temporary link */
  19.  
  20. /* STATIC & FORWARD must agree to avoid redeclarations(!) */
  21. #define STATIC    static        /* "static" when not debugging|profiling */
  22.  
  23. /* adapt to compiler limitations */
  24. #ifdef pdp11
  25. # define FORWARD            /* "static" except for dmr's 11 compiler */
  26. #else
  27. # define FORWARD static        /* "static" except for dmr's 11 compiler */
  28. #endif
  29.  
  30. #if 0
  31. #define void int        /* if your compiler doesn't understand void's */
  32. #define MAXLONG 017777777777L
  33.                         /* if your compiler lacks "unsigned long" type */
  34. #endif
  35.  
  36. /* adapt to library limitations */
  37. #define NOSTOREVAL
  38.         /* qqq if your dbm store() returns no value (as in orig. v7) */
  39.  
  40. /* fundamental constants of the implementation */
  41. #define SMALLMEM    /* qqq for PDP-11s, PDP-8s, IBM PCs, etc. */
  42. #define    FASTINDEX    /* qqq if string functions are very fast */
  43.  
  44. /* automatic configuration */
  45. #ifdef pdp11
  46. # ifndef SMALLMEM
  47. #  define SMALLMEM
  48. # endif                /* SMALLMEM */
  49. #endif                /* pdp11 */
  50.  
  51. /* types */
  52. typedef short statust;
  53. typedef char boolean;
  54.  
  55. /* status bits */
  56. #define ST_OKAY            0    /* nothing wrong */
  57. #define ST_SHORT    (1<<1)    /* art shorter than byte count; truncated? */
  58. #define ST_ACCESS    (1<<2)    /* no access permission */
  59. #define ST_REFUSED    (1<<3)    /* article was deliberately refused - OK */
  60. #define ST_DROPPED    (1<<4)    /* article was accidentally dropped */
  61. #define ST_DISKFULL    (1<<5)    /* disk full - give up */
  62. #define ST_JUNKED    (1<<6)    /* article was accepted, but junked */
  63.  
  64. /* newsgroup specific definitions */
  65. #define NGSEP        ','        /* separates groups */
  66. #define NGNEG        '!'        /* preceding a pattern, negates it */
  67. #define NGDELIM        '.'        /* within a group */
  68. #define FNDELIM        '/'        /* within a group, on disk */
  69. #define SFNDELIM    "/"        /* string of FNDELIM */
  70.  
  71. /* macros, replacing functions for speed */
  72. #define iswhite(c) ((c) == ' ' || (c) == '\t')
  73.  
  74. #ifndef max
  75. #define max(a,b) ((a) > (b)? (a): (b))
  76. #define min(a,b) ((a) < (b)? (a): (b))
  77. #endif
  78.  
  79. /* STREQ is an optimised strcmp(a,b)==0 */
  80. #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
  81. /* STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0 */
  82. #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
  83. #define STRLEN(s) (sizeof (s) - 1)    /* s must be a char array */
  84.  
  85. #ifdef AMIGA
  86. # define index    strchr
  87. # define rindex    strrchr
  88. #endif /* AMIGA */
  89.  
  90. #ifdef FASTINDEX
  91. #define INDEX(src, chr, dest) (dest) = index(src, chr)
  92. extern char *index();
  93. #else
  94. #define INDEX(src, chr, dest) \
  95.     for ((dest) = (src); *(dest) != '\0' && *(dest) != (chr); ++(dest)) \
  96.         ; \
  97.     if (*(dest) == '\0') \
  98.         (dest) = NULL        /* N.B.: missing semi-colon */
  99. #endif
  100.  
  101. /* macros, of necessity */
  102. /* nnafree(any **) where "any" is any type; must be a macro */
  103. #define nnafree(mempp) (*(mempp) != 0 ? \
  104.     (free((char *)*(mempp)), (*(mempp) = 0)) : 0)
  105. #ifdef lint
  106. nnfree(mempp)        /* If *mempp is non-null, free it and zero it. */
  107. register char **mempp;            /* pointer to malloc'ed ptr. */
  108. {
  109.     if (*mempp != 0) {
  110.         free(*mempp);
  111.         *mempp = 0;
  112.     }
  113. }
  114. #else                    /* lint */
  115. #define nnfree nnafree
  116. #endif                    /* lint */
  117.  
  118. #define YES 1
  119. #define NO 0
  120.  
  121. #define NOTALLHDRS NO        /* hdrdump flags for "all headers seen?" */
  122. #define ALLHDRS YES
  123.  
  124. #define DEFEXP "-"            /* default expiry period */
  125.  
  126. /* imports from news */
  127. extern char *progname;
  128.  
  129. extern void fclsexec();                /* from libos */
  130. extern FILE *fopenexcl();            /* from libos */
  131. extern char *getcwd();                /* from libos */
  132.  
  133. extern FILE *fopenclex(), *fopenwclex(); /* from libcnews/fopenclex.c */
  134. extern char *gethdr();                /* from libcnews/gethdr.c */
  135. extern char *hostname();            /* from libcnews/hostname.c */
  136. extern void lockdebug();            /* from libcnews/lock.c */
  137. extern void newslock(), newsunlock(); /* from libcnews/lock.c *
  138.  
  139. extern void errunlock();            /* from libcnews/lock.c */
  140. extern int ltozan(), ltoza();        /* from libcnews/ltoza.c */
  141. extern void matchdebug();            /* from libcnews/ngmatch.c */
  142. extern boolean ngmatch();            /* from libcnews/ngmatch.c */
  143. extern void mkfilenm(), trim();        /* from libcnews/string.c */
  144. extern boolean anyhostin(), hostin();/* from libcnews/string.c */
  145. extern int hopcount();                /* from libcnews/string.c */
  146. extern char *skipsp(), *first(), *strsvto(); /* from libcnews/string.c */
  147. extern char *sendersite(), *nullify();    /* from libcnews/string.c */
  148. extern char *canonpath();            /* from libcnews/string.c */
  149. extern void timestamp();            /* from libcnews/time.c */
  150.  
  151. #ifndef error
  152. #  define error        Error
  153. #endif
  154.  
  155. extern void warning(), error();        /* from libc */
  156. extern void standard();                /* from libc */
  157. extern void closeall();                /* from libc */
  158. extern void stdfdopen();            /* from libc */
  159. extern int nfclose();                /* from libc */
  160.  
  161. #include "alloc.h"                /* ugh */
  162. #endif /* _NEWS_H_ */
  163.